﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;

namespace GieldaCSharp
{
    class WykresPunkty : Wykres
    {
        private Brush brush;
        protected int iOdC;
        protected int iDoC;

        public WykresPunkty(List<kursV> _lista, Pen _pioro, Brush _brush, Border _b, int _Od, int _Do, int _iOdC, int _iDoC) 
        { 
            brush = _brush; pioro = _pioro; lista = _lista;
            UstalStart(_Od, _Do);
            iOdC = _iOdC;
            iDoC = _iDoC;
            b = _b;
        }

        public override void Draw(PictureBox p, Graphics g, double maxY, double minY, int N)
        {
            Point point = Point.Empty;

            if (0 != lista.Count)
            {
                for (int i = iOd; i <= iDo; i++)
                {
                    point.X = PrzeskalujX(lista[i].x - iOdC, N);
                    point.Y = PrzeskalujY(lista[i].kurs, maxY, minY);
                    
                    if (lista[i].x <= iDoC)
                    {
                        Rectangle rec = new Rectangle(point.X - 2, point.Y - 2, 4, 4);

                        g.FillEllipse(brush, rec);
                        g.DrawEllipse(pioro, rec);
                    }

                }
            }
        }
    }
}
